//
//  HomeMemberVC.m
//  Meum
//
//  Created by 黄卫 on 17/3/1.
//  Copyright © 2017年 huangwei. All rights reserved.
//

#import "HomeMemberVC.h"
#import "HomeMemInfoVC.h"
@interface HomeMemberVC ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong)NSArray *titleArr;
@property(nonatomic,strong)NSArray *detailArr;
@end

@implementation HomeMemberVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"家庭成员";
    _titleArr = @[@"张小萌",@"张大萌",@"老李头"];
    _detailArr =  @[@"小女儿",@"大女儿",@"父亲"];
    [self.view addSubview:self.tableView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [UITableView plainTableView];
        _tableView.delegate = self;
        _tableView.dataSource =self;
        
    }
    return _tableView;
}

#pragma mark UITableViewDelegate

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titleArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.text = self.titleArr[indexPath.row];
    cell.detailTextLabel.text = self.detailArr[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    HomeMemInfoVC *homeInfoVc = [[HomeMemInfoVC alloc] init];
    [self.navigationController pushViewController:homeInfoVc animated:YES];
}

@end
